package codepulse.blogmoon.cn.system.controller;

import codepulse.blogmoon.cn.common.context.Context;
import codepulse.blogmoon.cn.common.entity.Result;
import codepulse.blogmoon.cn.system.dto.CreateTeamDTO;
import codepulse.blogmoon.cn.system.dto.TeamInfoDTO;
import codepulse.blogmoon.cn.system.entity.TeamInfo;
import codepulse.blogmoon.cn.system.service.TeamInfoService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/team")
public class TeamController {

    @Resource
    private TeamInfoService teamInfoService;

    @PostMapping("/create")
    public Result createTeam(@RequestBody CreateTeamDTO dto) {
        teamInfoService.createTeam(dto);
        return Result.success();
    }

    @GetMapping("/self-team-list")
    public Result listSelfTeam() {
        List<TeamInfoDTO> teamInfos = teamInfoService.listSelfTeam(Context.get().getBizAcctId());
        return Result.success(teamInfos);
    }


}
